﻿#include <Sys\RenderUnit\SysRenderDatagram\PRIMITIVERD.HPP>

using namespace CxxlMan;
using namespace Cxxl3D;

#define CTrianglesStrip_ClassID L"BD2B83F8B2B6413386CA1AD028E7207D"

cxxlObject *cxxlFASTCALL New_CTrianglesStripRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesStripRD(const wchar_t *ClassID);


class CTrianglesStripRD:public ITrianglesStripRD
{
  // P2Smart_Ptr<IVertex> m_IVertexStripRD_Ptr;

/*
  virtual void cxxlFASTCALL SetVertexStrip(const Smart_Ptr<IVertex> &IVertexStripRD_Arg)
  {
    csPreserve.Enter();
    m_IVertexStripRD_Ptr = IVertexStripRD_Arg;
    csPreserve.Leave();
  }

  virtual Smart_Ptr<IVertex> cxxlFASTCALL GetVertexStrip() const
  {
    CriticalSecHandle AutoCSH(csPreserve);

    return m_IVertexStripRD_Ptr;
  }
*/

protected:
  // 儲存容器藉此取得要永續存取的屬性資料
  // 延伸類別須以 virtual 的形式覆寫
  // 並且須呼叫上層類別的此函數
  virtual bool cxxlFASTCALL Ref(Filter *F)
  {
    if(F != NULL && ITrianglesStripRD::Ref(F))
    {
      return true;
    }
    else
      return false;
  }


public:
  // Constructor
  CTrianglesStripRD()
    :cxxlObject(CxxlMan::Spirit_Easy),
    cxxlPreserve2(CTrianglesStrip_ClassID) // 在建構時指定 ClassID
    // m_IVertexStripRD_Ptr(NULL,this,L"VS")
  {
  }

  // Destructor
  ~CTrianglesStripRD()
  {
  }

  friend cxxlObject *cxxlFASTCALL New_CTrianglesStripRD();
  friend cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesStripRD(const wchar_t *ClassID);
};

cxxlObject *cxxlFASTCALL New_CTrianglesStripRD()
{
  return new CTrianglesStripRD();
}

cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesStripRD(const wchar_t *ClassID)
{
  if(wcscmp(CTrianglesStrip_ClassID, ClassID) == 0)
    return new CTrianglesStripRD;
  else
    return NULL;
}

/******************************************************************************************/

#define CTrianglesList_ClassID L"F12D877FC698430d8BA3C3A8C0441370"

cxxlObject *cxxlFASTCALL New_CTrianglesListRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesListRD(const wchar_t *ClassID);


class CTrianglesListRD:public ITrianglesListRD
{
  // P2Smart_Ptr<IVertex> m_IVertexListRD_Ptr;

/*
  virtual void cxxlFASTCALL SetVertexList(const Smart_Ptr<IVertex> &IVertexListRD_Arg)
  {
    csPreserve.Enter();
    m_IVertexListRD_Ptr = IVertexListRD_Arg;
    csPreserve.Leave();
  }

  virtual CxxlMan::Smart_Ptr<IVertex> cxxlFASTCALL GetVertexList() const
  {
    CriticalSecHandle AutoCSH(csPreserve);

    return m_IVertexListRD_Ptr;
  }
*/

protected:
  // 儲存容器藉此取得要永續存取的屬性資料
  // 延伸類別須以 virtual 的形式覆寫
  // 並且須呼叫上層類別的此函數
  virtual bool cxxlFASTCALL Ref(Filter *F)
  {
    if(F != NULL && ITrianglesListRD::Ref(F))
    {
      return true;
    }
    else
      return false;
  }

public:
  // Constructor
  CTrianglesListRD()
    :cxxlObject(CxxlMan::Spirit_Easy),
    cxxlPreserve2(CTrianglesList_ClassID) // 在建構時指定 ClassID
    // m_IVertexListRD_Ptr(NULL,this,L"VS")
  {
  }

  // Destructor
  ~CTrianglesListRD()
  {
  }


  friend cxxlObject *cxxlFASTCALL New_CTrianglesListRD();
  friend cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesListRD(const wchar_t *ClassID);
};

cxxlObject *cxxlFASTCALL New_CTrianglesListRD()
{
  return new CTrianglesListRD();
}

cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesListRD(const wchar_t *ClassID)
{
  if(wcscmp(CTrianglesList_ClassID, ClassID) == 0)
    return new CTrianglesListRD;
  else
    return NULL;
}
